/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tweetbotserver;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import tweetbotserver.robot.comms.RobotCommunicationsManager;
import tweetbotserver.server.comms.TwitterCommunicationsManager;

/**
 *
 * @author Mike
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {


        RobotCommunicationsManager robotComms = new RobotCommunicationsManager("NXT");
        TwitterCommunicationsManager twitterComms = new TwitterCommunicationsManager("Tw33tBot", "tweettweet");

        // connect twitter and robot comms managers

        TweetBotController controller = new TweetBotController(robotComms, twitterComms);


        try {

            boolean connected = robotComms.connect();

            if (connected) {

                // start the robot comms manager to allow messages to be sent to and received from the robot
                robotComms.start();

                // start the twitter comms manager to allow tweets to be handled.
                twitterComms.start();


                InputStreamReader inputStreamReader = new InputStreamReader(System.in);
                BufferedReader reader = new BufferedReader(inputStreamReader);


                while(true)
                {

                    System.out.println("Message to send:");
                    String message = reader.readLine();
                    controller.handleTwitterMessage(message);
                    
                }

                //for (int i = 0; i < 5; i++) {
                //    controller.handleTwitterMessage("test message" + i);
                //}




            }

        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}

